package com.hfzy.ihk.web.ivr.context;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;

/**
 * 描述:获取spring上下文
 *Spring动态注册rmi bean
 */
@Component
public class CloudCallInitializingBean implements ApplicationContextAware {


    private static ApplicationContext ctx;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext)
            throws BeansException {

        CloudCallInitializingBean.ctx = applicationContext;

        initUtils();

    }

    public void initUtils(){
//


    }

    public static ApplicationContext getApplicationContext(){
        return ctx;
    }

    public static String getRealPath(String path){
        return ((WebApplicationContext)ctx).getServletContext().getRealPath(path);
    }

}